using System.ComponentModel.DataAnnotations;
using FytSoa.Common.Enum;
using FytSoa.Domain.Crm;
using SqlSugar;

namespace FytSoa.Domain.Erp;

/// <summary>
/// erp-销售退货表
/// </summary>
[SugarTable("erp_sales_return")]
public class ErpSalesReturn:Entity
{
    /// <summary>
    /// 退单编号
    /// </summary>
    public string Number { get; set; }
    
    /// <summary>
    /// 原订单号
    /// </summary>
    [Required]
    public long OrderId { get; set; }
    
    /// <summary>
    /// 订单信息
    /// </summary>
    [Navigate(NavigateType.OneToOne, nameof(OrderId))]
    public ErpSalesOrder Order { get; set; }

    /// <summary>
    /// 客户ID
    /// </summary>
    [Required]
    public long CustomerId { get; set; }
    
    /// <summary>
    /// 客户信息
    /// </summary>
    [Navigate(NavigateType.OneToOne, nameof(CustomerId))]
    public CrmCustomer Customer { get; set; }

    /// <summary>
    /// 退货时间
    /// </summary>
    public DateTime? ReturnDate { get; set; }

    /// <summary>
    /// 应退金额
    /// </summary>
    [Required]
    public decimal TotalRefund { get; set; }

    /// <summary>
    /// '待审核','已同意','已退款','已驳回'
    /// </summary>
    [Required]
    public ErpSalesReturnStatusEnum Status { get; set; } = ErpSalesReturnStatusEnum.UnAudited;

    /// <summary>
    /// 退货原因
    /// </summary>
    [Required]
    [StringLength(100)]
    public string Reason { get; set; }

    /// <summary>
    /// 创建人
    /// </summary>
    public string CreateUser { get; set; }

    /// <summary>
    /// 创建时间
    /// </summary>
    [Required]
    public DateTime CreateTime { get; set; } = DateTime.Now;

    /// <summary>
    /// 更新人
    /// </summary>
    public string UpdateUser { get; set; }

    /// <summary>
    /// 更新时间
    /// </summary>
    public DateTime? UpdateTime { get; set; }


}